﻿/********************************************************************************
     File:																
            BusinessFacade.cs                         
     Description:
            业务逻辑类
     Author:									
            DDBuildTools
            http://DDBuildTools.supesoft.com
     Finish DateTime:
			2011-10-15 22:58:27
     History:
*********************************************************************************/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using repproblem.Components;
using repproblem.Data;

using FrameWork.Components;

namespace repproblem
{
    /// <summary>
    /// 业务逻辑类
    /// </summary>
    public partial class BusinessFacaderepproblem
    {

        #region "its_RepProblem() - Method"
        /// <summary>
        /// 新增/删除/修改 its_RepProblemEntity ()
        /// </summary>
        /// <param name="fam">its_RepProblemEntity实体类</param>
        /// <returns>-1:存储过程执行失败,-2:存在相同的主键,Insert:返回插入自动ID,Update:返回更新记录数,Delete:返回删除记录数</returns>
        public static Int32 its_RepProblemInsertUpdateDelete(its_RepProblemEntity fam)
        {
            return DataProvider.Instance().its_RepProblemInsertUpdateDelete(fam);
        }

        /// <summary>
        /// 返回its_RepProblemEntity实体类的List对象 ()
        /// </summary>
        /// <param name="qp">查询类(非安全函数,传入参数请进行Sql字符串过滤)</param>
        /// <param name="RecordCount">返回记录总数</param>
        /// <returns>its_RepProblemEntity实体类的List对象()</returns>
        public static List<its_RepProblemEntity> its_RepProblemList(QueryParam qp, out int RecordCount)
        {
            qp.TableName = "its_RepProblem";
            qp.ReturnFields = "*";
            if (qp.Orderfld == null)
            {
                qp.Orderfld = "ID";
            }
            return DataProvider.Instance().its_RepProblemList(qp, out RecordCount);
        }
 
        /// <summary>
        /// 根据ID返回 its_RepProblemEntity实体类 单笔资料 ()
        /// </summary>
        /// <param name="ID">ID </param>
        /// <returns>返回返回 its_RepProblemEntity实体类 ID为0则无记录</returns>
        public static its_RepProblemEntity its_RepProblemDisp(Int32 ID)
        {
            its_RepProblemEntity fam = new its_RepProblemEntity();
            QueryParam qp = new QueryParam();
            qp.PageIndex = 1;
            qp.PageSize = 1;
            qp.Where = string.Format(" Where {0}.{1} = {2}","its_RepProblem","ID",ID);
            int RecordCount = 0;
            List<its_RepProblemEntity> lst = its_RepProblemList(qp, out RecordCount);
            if (RecordCount > 0)
            {
                fam = lst[0];
            }
            return fam;
        }
        #endregion
         
       
        #region "获取表中字段值"
        /// <summary>
        /// 获取表中字段值(非安全函数,传入参数请进行Sql字符串过滤)
        /// </summary>
        /// <param name="table_name">表名</param>
        /// <param name="table_fileds">字段</param>
        /// <param name="where_fileds">查询条件字段</param>
        /// <param name="where_value">查询值</param>
        /// <returns></returns>
        public static string get_table_fileds(string table_name, string table_fileds, string where_fileds, string where_value)
        {
            return DataProvider.Instance().get_table_fileds(table_name, table_fileds, where_fileds, where_value);
        }
        #endregion

        #region "列新表中字段值"
        /// <summary>
        /// 更新表中字段值(非安全函数,传入参数请进行Sql字符串过滤)
        /// </summary>
        /// <param name="Table">表名</param>
        /// <param name="Table_FiledsValue">需要更新值(不用带Set)</param>
        /// <param name="Wheres">更新条件(不用带Where)</param>
        /// <returns></returns>
        public static int Update_Table_Fileds(string Table, string Table_FiledsValue, string Wheres)
        {
            return DataProvider.Instance().Update_Table_Fileds(Table, Table_FiledsValue, Wheres);
        }

        #endregion
    }
}